<template>
  <div class='activities first-box'>
    <Search :searchFun="getSearch"></Search>
    <LineGray></LineGray>

    <div class="tab-box">
      <Tab :listData="tabData" :selected="selectedIndex" :className="{padding10:true}"></Tab>
    </div>

    <Scroll :hasmore="hasmore" :pullup="pullup" setHeight="-109">
      <List :data="listData" :listname="listname" :selectedIndex="selectedIndex"></List>
    </Scroll>

  </div>
</template>
<script>
import Search from '../../common/search'
import LineGray from '../../common/line.vue'
import Tab from '../../common/tab'
import Scroll from '../../common/scroller'
import List from './list.vue'

export default {
  components: {Search,LineGray,Tab,Scroll,List},
  name: "",
  data() {
    return {
      tabData:[
        {
          name:"普通活动",
          click:this.changeTab,
          listname:"报名查询",
          type:0,
        },{
          name:"三人成团",
          click:this.changeTab,
          listname:"报名查询",
          type:1,
        },{
          name:"活动抽奖",
          click:this.changeTab,
          listname:"中奖查询",
          type:2,
        },{
          name:"推荐有礼",
          click:this.changeTab,
          listname:"推荐查询",
          type:3,
        },
      ],
      selectedIndex:0,
      hasmore:false,
      listname:"报名查询",

      listData:[
        {
          id:1,
          img:"https://ss2.baidu.com/6ONYsjip0QIZ8tyhnq/it/u=601844189,3105094554&fm=173&app=25&f=JPEG?w=218&h=146&s=91945F965833328C6B344EFF03005017",
          title:"更换一大堆乱七八糟的东西",
          starttime:"2018-05-20 10:32",
          endtime:"2018-05-20 10:32",
          state:1,//0下架,1 正常
        },{
          id:1,
          img:"https://ss2.baidu.com/6ONYsjip0QIZ8tyhnq/it/u=601844189,3105094554&fm=173&app=25&f=JPEG?w=218&h=146&s=91945F965833328C6B344EFF03005017",
          title:"更换一大堆乱七八糟的东西",
          starttime:"2018-05-20 10:32",
          endtime:"2018-05-20 10:32",
          state:0,//0下架,1 正常
        }
      ]
    };
  },
  methods: {
    getSearch(search){
      console.log("click----search",search)
    },

    // 下拉刷新方法回调
    pullup(func){
      console.log("发请求了") 
      func()
    },

    changeTab(item){
      this.selectedIndex=item.type
      this.listname=item.listname
      console.log("click---tab--change")
    },

    // 下拉刷新方法回调
    pullup(func){
      console.log("发请求了")

      func()
    }
  },
  created() {}
};
</script>
<style lang="scss" scoped>
.activities {
  background-color: #fff;
  .tab-box{
    background-color: #f2f2f2;
    padding-bottom: 1px;
  }
}
.padding10{
  padding-left: 10px;
  padding-right: 10px;
}
</style>